<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>图书管理</title>
        <%--base 和 jq文件 css--%>
        <jsp:include page="/pages/common/head.jsp"></jsp:include>
        <script>
            $(function () {
                $('.check-delete').click(function () {
                    return confirm("确定删除" + $(this).parent().parent().find("td:first").text() + "吗?")
                })
            })
        </script>
    </head>

    <body>

        <div id="header">
            <img class="logo_img" alt="" src="../../static/img/logo.gif">
            <span class="wel_word">图书管理系统</span>
            <%--包含manager模块菜单--%>
            <jsp:include page="/pages/common/manager_menu.jsp"></jsp:include>
        </div>

        <div id="main">
            <table>
                <tr>
                    <td>名称</td>
                    <td>价格</td>
                    <td>作者</td>
                    <td>销量</td>
                    <td>库存</td>
                    <td colspan="2">操作</td>
                </tr>


                <c:forEach items="${requestScope.page.items}" var="book">
                    <tr>
                        <td>${book.name}</td>
                        <td>${book.price}</td>
                        <td>${book.author}</td>
                        <td>${book.sales}</td>
                        <td>${book.stock}</td>
                        <td>
                            <a href="manager/bookServlet?action=getBook&id=${book.id}&pageNo=${requestScope.page.pageNo}">修改</a>
                        </td>
                        <td><a class="check-delete"
                               href="manager/bookServlet?action=delete&id=${book.id}&pageNo=${requestScope.page.pageNo}">删除</a>
                        </td>
                    </tr>
                </c:forEach>

                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td><a href="pages/manager/book_edit.jsp?pageNo=${requestScope.page.pageTotal}">添加图书</a></td>
                </tr>
            </table>

            <jsp:include page="/pages/common/page_nav.jsp"></jsp:include>

        </div>


        <%--页脚内容--%>
        <jsp:include page="/pages/common/footer.jsp"></jsp:include>
    </body>
</html>